/*
 * @Author: hechengfei h349187021@163.com
 * @Date: 2022-08-15 18:38:00
 * @LastEditors: hechengfei h349187021@163.com
 * @LastEditTime: 2022-08-23 14:47:21
 * @FilePath: \xiangmu\src\service\contractservice.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import axios from '../../utils/axios'
import api from '../../api'
//所有合同信息
export function getcontractquerylist({ currentPage, pageSize }) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_QUERY_LIST,
            params: { currentPage: currentPage, pageSize: pageSize },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//今日新增合同
export function getcontracttodayadd({ currentPage, pageSize }) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_TODAY_ADD,
            params: { currentPage: currentPage, pageSize: pageSize },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//本周新增合同
export function getcontractweekadd({ currentPage, pageSize }) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_WEEK_ADD,
            params: { currentPage: currentPage, pageSize: pageSize },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//本月新增合同
export function getcontractmonthadd({ currentPage, pageSize }) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_MONTH_ADD,
            params: { currentPage: currentPage, pageSize: pageSize },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//参看合同续费
export function getRenewallist({ contract_no, currentPage, pageSize }) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_RENEWAL_NO,
            params: { contract_no, currentPage, pageSize },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//今日到期
export function getcontractduetoday({ currentPage, pageSize }) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_DUE_TODAY,
            params: { currentPage: currentPage, pageSize: pageSize },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//本周到期
export function getcontractdueweek({ currentPage, pageSize }) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_DUE_WEEK,
            params: { currentPage: currentPage, pageSize: pageSize },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//本月到期
export function getcontractduemonth({ currentPage, pageSize }) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_DUE_MONTH,
            params: { currentPage: currentPage, pageSize: pageSize },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
// 添加客户
export function getcustomeradd(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_ADD_CUSTOMER,
            data: { ...obj },
            method: 'post'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//修改合同状态
export function changestute(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_CHANGE_STATE,
            params: { ...obj },
            method: 'post'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
// 修改合同到款
export function changegetmoney(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_RECEVI_NO,
            params: { ...obj },
            method: 'post'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//修改合同信息
export function changecontractinfobyname(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_CHANGEINFO_NAME,
            params: { ...obj },
            method: 'post'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
// 新增合同信息
export function addcontractinfo(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_ADD,
            data: obj,
            method: 'post',
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
//删除合同信息
export function deletecontractinfobyno(contract_no) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_DELETE_NO,
            params: { contract_no },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
// 高级搜索
export function searchcontractinfoall(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_SEARCH_ALL,
            params: { ...obj },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
// 搜索
export function searchcontractinfo(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_SEARCH,
            params: { ...obj },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
// 续费表
export function searchfeedlist(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_FEEDLISTBYNO,
            params: { ...obj },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
export function addfeedlist(obj) {
    return new Promise((resovle, reject) => {
        axios({
            url: api.contractAll.contractApi.CONTRACT_FEEDLIST_ADD,
            params: { ...obj },
            method: 'get'
        }).then((data) => {
            resovle(data)
        }).catch((err) => {
            reject(err)
        })
    })
}
